<template>
  <el-card shadow="never" class="aui-card--fill">
    <hx-add-user-view v-if="addOrUpdateVisible" ref="HxAddUserView"></hx-add-user-view>
  </el-card>
</template>

<script>
import HxAddUserView from '@/components/hx-add-user-view'

export default {
  data () {
    return {
      addOrUpdateVisible: false
    }
  },
  created () {
    this.getSysInfo()
  },
  methods: {
    getSysInfo () {
      // 更新环信用户
      this.$WebImOptions.user = this.$store.state.imUserList.teacherMap.hxAccount
      this.$WebImOptions.pwd = this.$store.state.imUserList.teacherMap.password
      // 当前登录人
      this.$store.state.imUserList.user = {
        name: this.$store.state.imUserList.teacherMap.hxAccount,
        password: this.$store.state.imUserList.teacherMap.password
      }
      // 登录
      this.$imConn.open(this.$WebImOptions)
      console.log('打开' + this.$WebImOptions.user)
      this.addOrUpdateVisible = true
      this.$nextTick(() => {
        this.$refs.HxAddUserView.userName = this.$WebImOptions.user
        this.$refs.HxAddUserView.init()
      })
    }
  },
  components: {
    HxAddUserView
  }
}
</script>
